package com.crm.services;

import java.util.Iterator;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.crm.model.jdao.IAuthorityDAO;
import com.crm.model.pojo.Power;

@Service
public class AuthorityServices {

	@Autowired
	private IAuthorityDAO authorityDAO;//权限dao
	
	/**
	 * 查找权限
	 * @param begin
	 * @param ends
	 * @return
	 */
	public List<Power> findBypidBetween(int begin,int ends) {
		return authorityDAO.findBypIdBetween(begin, ends);
	}
	
	/**
	 * 查询全部权限
	 * @return 
	 */
	public Iterable<Power> findPower() {
		Iterable<Power> findAll = authorityDAO.findAll();
		//迭代器用于while循环
//		Iterator iter = findAll.iterator();
//	    while(iter.hasNext()){
//	        String str = (String) iter.next();
//	        System.out.println(str);
//	        return str;
//	    }
		return findAll;  
	}
	
	public List<Power> findPowers() {
		List<Power> findAll = authorityDAO.findAll();
		return findAll;
	}
}
